package fft;
import java.io.File;
import javax.swing.filechooser.FileFilter;
/**
 * @brief A filter for the file chooser. In this case we only want .wav files and folders.
 * @author Frequency Flyers
 */
public class extensionFilter extends FileFilter {

    /**@brief Accept a file and read it's extension. Return only directories and .wav*/
    @Override
    public boolean accept(File f) {
        String filename = f.getName();
        if (filename.endsWith(".wav")) {
            return filename.endsWith(".wav");
        } else if (f.isDirectory()) {
            return f.isDirectory();
        }
        return false;
    }

    /**@brief Return the description to be displayed in the file chooser*/
    @Override
    public String getDescription() {
        return "*.wav";
    }
}
